package com.kgc.ssm.service.Impl;

import com.github.pagehelper.PageHelper;
import com.kgc.ssm.beans.Goods;
import com.kgc.ssm.mapper.GoodsMapper;
import com.kgc.ssm.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Administrator
 * @version 1.0
 * @date 2021/11/24 9:57
 * @Description:产品信息业务接口实现类
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;


    /**
     * @return 后台产品数据列表
     */
    @Override
    public List<Goods> queryGoodsList() {
//        PageHelper.offsetPage()
        return goodsMapper.selectGoodsList();
    }



    /**
     * @Author bai
     * @Date  2021/11/25
     *Description:后台管理根据pid查询
     */
    @Override
    public Goods AfterSelectGoods(Integer pid) {
        return goodsMapper.AfterSelectGoods(pid);
    }


    /**
     * @Author bai
     * @Date 2021/11/24
     * Description:删除商品
     */
    @Override
    public int delAfterGoods(Integer pid) {

        return goodsMapper.delAfterGoods(pid);
    }


    /**
     *
     * @return 前台商品页面信息展示
     */
    @Override
    public List<Goods> selectAll() {
        return goodsMapper.selectAll();
    }

    @Override
    public List<Goods> selectAllByPriceFirst() {
        return goodsMapper.selectAllByPriceFirst();
    }

    @Override
    public List<Goods> selectAllByPriceSecond() {
        return goodsMapper.selectAllByPriceSecond();
    }

    @Override
    public List<Goods> selectAllByStock() {
        return goodsMapper.selectAllByStock();
    }


    /**
     * @Author bai
     * @Date  2021/11/25
     *Description:后台管理商品列表模糊查询
     */
    @Override
    public List<Goods> AfterDimGoodsItems(String keyword) {
        return goodsMapper.AfterDimGoodsItems(keyword);
    }



    /**
     * @Author bai
     * @Date  2021/11/25
     *Description:修改后台管理商品
     */
    @Override
    public int AfterModGoods(Goods goods) {
        return goodsMapper.AfterModGoods(goods);
    }


    /**
     * @Author bai
     * @Date  2021/11/25
     *Description:后台管理商品的新增
     */

    @Override
    public int AfterAddGoods(Goods goods) {
        return goodsMapper.AfterAddGoods(goods);
    }

}

